package br.edu.ufcg.compiladores.brasigol.semantico;

import java.util.Stack;

public class PilhaDeLabels{

	private static final long serialVersionUID = 7988381448133667910L;
	private Stack<String> pilha;
	
	public PilhaDeLabels(){
		pilha = new Stack<String>();
	}
	
	public void empilha(String label){
		pilha.push(label);
	}
	
	public String desempilha(){
		return pilha.pop();
	}
	
	public String makeLabel(){
		int size = pilha.size();
		String label = "L"+(size < 10 ? "00" + size : (size < 100 ? "0" + size : size));
		return label;
	}
	
	
}
